--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Node / ReticulumProjects / Sideband.git / files / sbapp / kivymd / uix / navigationdrawer / navigationdrawer.py
Displaying Raw • Download
sbapp/kivymd/uix/navigationdrawer/navigationdrawer.py f8b3e3760b831745cf10d97aeae64e9c00a136a9 (f8b3e376) Text, 46.33 KB
T8b949e"""
Components/NavigationDrawer
===========================
.. seealso::
`Material Design 2 spec, Navigation drawer <https://material.io/components/navigation-drawer>`_ and
`Material Design 3 spec, Navigation drawer <https://m3.material.io/components/navigation-drawer/overview>`_
.. rubric:: Navigation drawers provide access to destinations in your app.
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/navigation-drawer.png
:align: center
When using the class :class:`~MDNavigationDrawer` skeleton of your `KV` markup
should look like this:
Anatomy
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
.. code-block:: kv
Root:
MDNavigationLayout:
MDScreenManager:
Screen_1:
Screen_2:
MDNavigationDrawer:
# This custom rule should implement what will be appear in your
# MDNavigationDrawer.
ContentNavigationDrawer:
A simple example
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
.. tabs::
.. tab:: Declarative KV styles
.. code-block:: python
from kivy.lang import Builder
from kivymd.uix.boxlayout import MDBoxLayout
from kivymd.app import MDApp
KV = '''
MDScreen:
MDNavigationLayout:
MDScreenManager:
MDScreen:
MDTopAppBar:
title: "Navigation Drawer"
elevation: 4
pos_hint: {"top": 1}
md_bg_color: "#e7e4c0"
specific_text_color: "#4a4939"
left_action_items:
[['menu', lambda x: nav_drawer.set_state("open")]]
MDNavigationDrawer:
id: nav_drawer
radius: (0, 16, 16, 0)
ContentNavigationDrawer:
'''
class ContentNavigationDrawer(MDBoxLayout):
pass
class Example(MDApp):
def build(self):
self.theme_cls.theme_style = "Dark"
return Builder.load_string(KV)
Example().run()
.. tab:: Declarative python styles
.. code-block:: python
from kivymd.app import MDApp
from kivymd.uix.boxlayout import MDBoxLayout
from kivymd.uix.navigationdrawer import MDNavigationLayout, MDNavigationDrawer
from kivymd.uix.screen import MDScreen
from kivymd.uix.screenmanager import MDScreenManager
from kivymd.uix.toolbar import MDTopAppBar
class ContentNavigationDrawer(MDBoxLayout):
pass
class Example(MDApp):
def build(self):
self.theme_cls.theme_style = "Dark"
return(
MDScreen(
MDNavigationLayout(
MDScreenManager(
MDScreen(
MDTopAppBar(
title="Navigation Drawer",
elevation=4,
pos_hint={"top": 1},
md_bg_color="#e7e4c0",
specific_text_color="#4a4939",
left_action_items=[
['menu', lambda x: self.nav_drawer_open()]
],
)
)
),
MDNavigationDrawer(
ContentNavigationDrawer(),
id="nav_drawer",
radius=(0, 16, 16, 0),
),
),
),
)
def nav_drawer_open(self, *args):
nav_drawer = self.root.children[0].ids.nav_drawer
nav_drawer.set_state("open")
Example().run()
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/navigation-drawer.gif
:align: center
.. Note:: :class:`~MDNavigationDrawer` is an empty
:class:`~kivymd.uix.card.MDCard` panel.
Standard content for the navigation bar
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
.. tabs::
.. tab:: Declarative KV styles
.. code-block:: python
from kivy.lang import Builder
from kivymd.app import MDApp
KV = '''
<DrawerClickableItem@MDNavigationDrawerItem>
focus_color: "#e7e4c0"
text_color: "#4a4939"
icon_color: "#4a4939"
ripple_color: "#c5bdd2"
selected_color: "#0c6c4d"
<DrawerLabelItem@MDNavigationDrawerItem>
text_color: "#4a4939"
icon_color: "#4a4939"
focus_behavior: False
selected_color: "#4a4939"
_no_ripple_effect: True
MDScreen:
MDNavigationLayout:
MDScreenManager:
MDScreen:
MDTopAppBar:
title: "Navigation Drawer"
elevation: 4
pos_hint: {"top": 1}
md_bg_color: "#e7e4c0"
specific_text_color: "#4a4939"
left_action_items: [["menu", lambda x: nav_drawer.set_state("open")]]
MDNavigationDrawer:
id: nav_drawer
radius: (0, 16, 16, 0)
MDNavigationDrawerMenu:
MDNavigationDrawerHeader:
title: "Header title"
title_color: "#4a4939"
text: "Header text"
spacing: "4dp"
padding: "12dp", 0, 0, "56dp"
MDNavigationDrawerLabel:
text: "Mail"
DrawerClickableItem:
icon: "gmail"
right_text: "+99"
text_right_color: "#4a4939"
text: "Inbox"
DrawerClickableItem:
icon: "send"
text: "Outbox"
MDNavigationDrawerDivider:
MDNavigationDrawerLabel:
text: "Labels"
DrawerLabelItem:
icon: "information-outline"
text: "Label"
DrawerLabelItem:
icon: "information-outline"
text: "Label"
'''
class Example(MDApp):
def build(self):
self.theme_cls.theme_style = "Dark"
return Builder.load_string(KV)
Example().run()
.. tab:: Declarative python styles
.. code-block:: python
from kivymd.app import MDApp
from kivymd.uix.navigationdrawer import (
MDNavigationLayout,
MDNavigationDrawer,
MDNavigationDrawerMenu,
MDNavigationDrawerHeader,
MDNavigationDrawerLabel,
MDNavigationDrawerDivider,
MDNavigationDrawerItem,
)
from kivymd.uix.screen import MDScreen
from kivymd.uix.screenmanager import MDScreenManager
from kivymd.uix.toolbar import MDTopAppBar
class BaseNavigationDrawerItem(MDNavigationDrawerItem):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.radius = 24
self.text_color = "#4a4939"
self.icon_color = "#4a4939"
self.focus_color = "#e7e4c0"
class DrawerLabelItem(BaseNavigationDrawerItem):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.focus_behavior = False
self._no_ripple_effect = True
self.selected_color = "#4a4939"
class DrawerClickableItem(BaseNavigationDrawerItem):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.ripple_color = "#c5bdd2"
self.selected_color = "#0c6c4d"
class Example(MDApp):
def build(self):
self.theme_cls.theme_style = "Dark"
return(
MDScreen(
MDNavigationLayout(
MDScreenManager(
MDScreen(
MDTopAppBar(
title="Navigation Drawer",
elevation=4,
pos_hint={"top": 1},
md_bg_color="#e7e4c0",
specific_text_color="#4a4939",
left_action_items=[
['menu', lambda x: self.nav_drawer_open()]
],
)
)
),
MDNavigationDrawer(
MDNavigationDrawerMenu(
MDNavigationDrawerHeader(
title="Header title",
title_color="#4a4939",
text="Header text",
spacing="4dp",
padding=("12dp", 0, 0, "56dp"),
),
MDNavigationDrawerLabel(
text="Mail",
),
DrawerClickableItem(
icon="gmail",
right_text="+99",
text_right_color="#4a4939",
text="Inbox",
),
DrawerClickableItem(
icon="send",
text="Outbox",
),
MDNavigationDrawerDivider(),
MDNavigationDrawerLabel(
text="Labels",
),
DrawerLabelItem(
icon="information-outline",
text="Label",
),
DrawerLabelItem(
icon="information-outline",
text="Label",
),
),
id="nav_drawer",
radius=(0, 16, 16, 0),
)
)
)
)
def nav_drawer_open(self, *args):
nav_drawer = self.root.children[0].ids.nav_drawer
nav_drawer.set_state("open")
Example().run()
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/navigation-drawer-standatd-content.gif
:align: center
Switching screens in the ``ScreenManager`` and using the common ``MDTopAppBar``
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
.. tabs::
.. tab:: Declarative KV styles
.. code-block:: python
from kivy.lang import Builder
from kivy.properties import ObjectProperty
from kivymd.app import MDApp
from kivymd.uix.scrollview import MDScrollView
KV = '''
<ContentNavigationDrawer>
MDList:
OneLineListItem:
text: "Screen 1"
on_press:
root.nav_drawer.set_state("close")
root.screen_manager.current = "scr 1"
OneLineListItem:
text: "Screen 2"
on_press:
root.nav_drawer.set_state("close")
root.screen_manager.current = "scr 2"
MDScreen:
MDTopAppBar:
pos_hint: {"top": 1}
elevation: 4
title: "MDNavigationDrawer"
left_action_items: [["menu", lambda x: nav_drawer.set_state("open")]]
MDNavigationLayout:
MDScreenManager:
id: screen_manager
MDScreen:
name: "scr 1"
MDLabel:
text: "Screen 1"
halign: "center"
MDScreen:
name: "scr 2"
MDLabel:
text: "Screen 2"
halign: "center"
MDNavigationDrawer:
id: nav_drawer
radius: (0, 16, 16, 0)
ContentNavigationDrawer:
screen_manager: screen_manager
nav_drawer: nav_drawer
'''
class ContentNavigationDrawer(MDScrollView):
screen_manager = ObjectProperty()
nav_drawer = ObjectProperty()
class Example(MDApp):
def build(self):
self.theme_cls.primary_palette = "Orange"
self.theme_cls.theme_style = "Dark"
return Builder.load_string(KV)
Example().run()
.. tab:: Declarative python styles
.. code-block:: python
from kivymd.app import MDApp
from kivymd.uix.label import MDLabel
from kivymd.uix.list import MDList, OneLineListItem
from kivymd.uix.navigationdrawer import MDNavigationLayout, MDNavigationDrawer
from kivymd.uix.screen import MDScreen
from kivymd.uix.screenmanager import MDScreenManager
from kivymd.uix.scrollview import MDScrollView
from kivymd.uix.toolbar import MDTopAppBar
class Example(MDApp):
def build(self):
self.theme_cls.primary_palette = "Orange"
self.theme_cls.theme_style = "Dark"
return (
MDScreen(
MDTopAppBar(
pos_hint={"top": 1},
elevation=4,
title="MDNavigationDrawer",
left_action_items=[["menu", lambda x: self.nav_drawer_open()]],
),
MDNavigationLayout(
MDScreenManager(
MDScreen(
MDLabel(
text="Screen 1",
halign="center",
),
name="scr 1",
),
MDScreen(
MDLabel(
text="Screen 2",
halign="center",
),
name="scr 2",
),
id="screen_manager",
),
MDNavigationDrawer(
MDScrollView(
MDList(
OneLineListItem(
text="Screen 1",
on_press=self.switch_screen,
),
OneLineListItem(
text="Screen 2",
on_press=self.switch_screen,
),
),
),
id="nav_drawer",
radius=(0, 16, 16, 0),
),
id="navigation_layout",
)
)
)
def switch_screen(self, instance_list_item: OneLineListItem):
self.root.ids.navigation_layout.ids.screen_manager.current = {
"Screen 1": "scr 1", "Screen 2": "scr 2"
}[instance_list_item.text]
self.root.children[0].ids.nav_drawer.set_state("close")
def nav_drawer_open(self):
nav_drawer = self.root.children[0].ids.nav_drawer
nav_drawer.set_state("open")
Example().run()
"""
Te6edf3__all__ Tff7b72= Tb4b4b4(
Ta5d6ff"Ta5d6ffMDNavigationLayoutTa5d6ff"Tb4b4b4,
Ta5d6ff"Ta5d6ffMDNavigationDrawerTa5d6ff"Tb4b4b4,
Ta5d6ff"Ta5d6ffMDNavigationDrawerItemTa5d6ff"Tb4b4b4,
Ta5d6ff"Ta5d6ffMDNavigationDrawerMenuTa5d6ff"Tb4b4b4,
Ta5d6ff"Ta5d6ffMDNavigationDrawerHeaderTa5d6ff"Tb4b4b4,
Ta5d6ff"Ta5d6ffMDNavigationDrawerLabelTa5d6ff"Tb4b4b4,
Ta5d6ff"Ta5d6ffMDNavigationDrawerDividerTa5d6ff"Tb4b4b4,
Tb4b4b4)
Tff7b72import T7ee787os
Tff7b72from T7ee787typing Tff7b72import Te6edf3Union
Tff7b72from T7ee787kivyT7ee787.T7ee787animation Tff7b72import Te6edf3AnimationTb4b4b4, Te6edf3AnimationTransition
Tff7b72from T7ee787kivyT7ee787.T7ee787clock Tff7b72import Te6edf3Clock
Tff7b72from T7ee787kivyT7ee787.T7ee787coreT7ee787.T7ee787window Tff7b72import Te6edf3Window
Tff7b72from T7ee787kivyT7ee787.T7ee787graphicsT7ee787.T7ee787context_instructions Tff7b72import Te6edf3Color
Tff7b72from T7ee787kivyT7ee787.T7ee787graphicsT7ee787.T7ee787vertex_instructions Tff7b72import Te6edf3Rectangle
Tff7b72from T7ee787kivyT7ee787.T7ee787lang Tff7b72import Te6edf3Builder
Tff7b72from T7ee787kivyT7ee787.T7ee787properties Tff7b72import Tb4b4b4(
Te6edf3AliasPropertyTb4b4b4,
Te6edf3BooleanPropertyTb4b4b4,
Te6edf3ColorPropertyTb4b4b4,
Te6edf3NumericPropertyTb4b4b4,
Te6edf3ObjectPropertyTb4b4b4,
Te6edf3OptionPropertyTb4b4b4,
Te6edf3StringPropertyTb4b4b4,
Te6edf3VariableListPropertyTb4b4b4,
Tb4b4b4)
Tff7b72from T7ee787kivyT7ee787.T7ee787uixT7ee787.T7ee787screenmanager Tff7b72import Te6edf3ScreenManager
Tff7b72from T7ee787kivymd Tff7b72import Te6edf3uix_path
Tff7b72from T7ee787kivymdT7ee787.T7ee787uixT7ee787.T7ee787behaviorsT7ee787.T7ee787focus_behavior Tff7b72import Te6edf3FocusBehavior
Tff7b72from T7ee787kivymdT7ee787.T7ee787uixT7ee787.T7ee787boxlayout Tff7b72import Te6edf3MDBoxLayout
Tff7b72from T7ee787kivymdT7ee787.T7ee787uixT7ee787.T7ee787card Tff7b72import Te6edf3MDCard
Tff7b72from T7ee787kivymdT7ee787.T7ee787uixT7ee787.T7ee787floatlayout Tff7b72import Te6edf3MDFloatLayout
Tff7b72from T7ee787kivymdT7ee787.T7ee787uixT7ee787.T7ee787list Tff7b72import Te6edf3MDListTb4b4b4, Te6edf3OneLineAvatarIconListItem
Tff7b72from T7ee787kivymdT7ee787.T7ee787uixT7ee787.T7ee787scrollview Tff7b72import Te6edf3MDScrollView
Tff7b72from T7ee787kivymdT7ee787.T7ee787uixT7ee787.T7ee787toolbar Tff7b72import Te6edf3MDTopAppBar
Tff7b72with Tffa657openTb4b4b4(
Te6edf3osTff7b72.Td2a8ffpathTff7b72.Td2a8ffjoinTb4b4b4(Te6edf3uix_pathTb4b4b4, Ta5d6ff"Ta5d6ffnavigationdrawerTa5d6ff"Tb4b4b4, Ta5d6ff"Ta5d6ffnavigationdrawer.kvTa5d6ff"Tb4b4b4)Tb4b4b4,
Te6edf3encodingTff7b72=Ta5d6ff"Ta5d6ffutf-8Ta5d6ff"Tb4b4b4,
Tb4b4b4) Tff7b72as Te6edf3kv_fileTb4b4b4:
Te6edf3BuilderTff7b72.Td2a8ffload_stringTb4b4b4(Te6edf3kv_fileTff7b72.Td2a8ffreadTb4b4b4(Tb4b4b4)Tb4b4b4)
Tff7b72class T56d364NavigationDrawerContentErrorTb4b4b4(Tf85149ExceptionTb4b4b4)Tb4b4b4:
Tff7b72pass
Tff7b72class T56d364MDNavigationLayoutTb4b4b4(Te6edf3MDFloatLayoutTb4b4b4)Tb4b4b4:
T8b949e"""
For more information, see in the
:class:`~kivymd.uix.floatlayout.MDFloatLayout` class documentation.
"""
Te6edf3_scrim_color Tff7b72= Te6edf3ObjectPropertyTb4b4b4(Tff7b72NoneTb4b4b4)
Te6edf3_scrim_rectangle Tff7b72= Te6edf3ObjectPropertyTb4b4b4(Tff7b72NoneTb4b4b4)
Te6edf3_screen_manager Tff7b72= Te6edf3ObjectPropertyTb4b4b4(Tff7b72NoneTb4b4b4)
Te6edf3_navigation_drawer Tff7b72= Te6edf3ObjectPropertyTb4b4b4(Tff7b72NoneTb4b4b4)
Tff7b72def Tff7b72__init__Tb4b4b4(Tff7b72selfTb4b4b4, Tff7b72*Te6edf3argsTb4b4b4, Tff7b72*Tff7b72*Te6edf3kwargsTb4b4b4)Tb4b4b4:
Tffa657superTb4b4b4(Tb4b4b4)Tff7b72.Td2a8ff__init__Tb4b4b4(Tff7b72*Te6edf3argsTb4b4b4, Tff7b72*Tff7b72*Te6edf3kwargsTb4b4b4)
Tff7b72selfTff7b72.Td2a8ffbindTb4b4b4(Te6edf3widthTff7b72=Tff7b72selfTff7b72.Td2a8ffupdate_posTb4b4b4)
Tff7b72def Td2a8ffupdate_posTb4b4b4(Tff7b72selfTb4b4b4, Te6edf3instance_navigation_drawerTb4b4b4, Te6edf3pos_xTb4b4b4: Tffa657floatTb4b4b4) Tff7b72-Tff7b72> Tff7b72NoneTb4b4b4:
Te6edf3drawer Tff7b72= Tff7b72selfTff7b72.Td2a8ff_navigation_drawer
Te6edf3manager Tff7b72= Tff7b72selfTff7b72.Td2a8ff_screen_manager
Tff7b72if Tff7b72not Te6edf3drawer Tff7b72or Tff7b72not Te6edf3managerTb4b4b4:
Tff7b72return
Tff7b72if Te6edf3drawerTff7b72.Td2a8fftype Tff7b72== Ta5d6ff"Ta5d6ffstandardTa5d6ff"Tb4b4b4:
Te6edf3managerTff7b72.Td2a8ffsize_hint_x Tff7b72= Tff7b72None
Tff7b72if Te6edf3drawerTff7b72.Td2a8ffanchor Tff7b72== Ta5d6ff"Ta5d6ffleftTa5d6ff"Tb4b4b4:
Te6edf3managerTff7b72.Td2a8ffx Tff7b72= Te6edf3drawerTff7b72.Td2a8ffwidth Tff7b72+ Te6edf3drawerTff7b72.Td2a8ffx
Te6edf3managerTff7b72.Td2a8ffwidth Tff7b72= Tff7b72selfTff7b72.Td2a8ffwidth Tff7b72- Te6edf3managerTff7b72.Td2a8ffx
Tff7b72elseTb4b4b4:
Te6edf3managerTff7b72.Td2a8ffx Tff7b72= T79c0ff0
Te6edf3managerTff7b72.Td2a8ffwidth Tff7b72= Te6edf3drawerTff7b72.Td2a8ffx
Tff7b72elif Te6edf3drawerTff7b72.Td2a8fftype Tff7b72== Ta5d6ff"Ta5d6ffmodalTa5d6ff"Tb4b4b4:
Te6edf3managerTff7b72.Td2a8ffsize_hint_x Tff7b72= Tff7b72None
Te6edf3managerTff7b72.Td2a8ffx Tff7b72= T79c0ff0
Tff7b72if Te6edf3drawerTff7b72.Td2a8ffanchor Tff7b72== Ta5d6ff"Ta5d6ffleftTa5d6ff"Tb4b4b4:
Te6edf3managerTff7b72.Td2a8ffwidth Tff7b72= Tff7b72selfTff7b72.Td2a8ffwidth Tff7b72- Te6edf3managerTff7b72.Td2a8ffx
Tff7b72elseTb4b4b4:
Te6edf3managerTff7b72.Td2a8ffwidth Tff7b72= Tff7b72selfTff7b72.Td2a8ffwidth
Tff7b72def Td2a8ffadd_scrimTb4b4b4(Tff7b72selfTb4b4b4, Te6edf3instance_managerTb4b4b4: Te6edf3ScreenManagerTb4b4b4) Tff7b72-Tff7b72> Tff7b72NoneTb4b4b4:
Tff7b72with Te6edf3instance_managerTff7b72.Td2a8ffcanvasTff7b72.Td2a8ffafterTb4b4b4:
Tff7b72selfTff7b72.Td2a8ff_scrim_color Tff7b72= Te6edf3ColorTb4b4b4(Te6edf3rgbaTff7b72=Tb4b4b4[T79c0ff0Tb4b4b4, T79c0ff0Tb4b4b4, T79c0ff0Tb4b4b4, T79c0ff0Tb4b4b4]Tb4b4b4)
Tff7b72selfTff7b72.Td2a8ff_scrim_rectangle Tff7b72= Te6edf3RectangleTb4b4b4(
Te6edf3posTff7b72=Te6edf3instance_managerTff7b72.Td2a8ffposTb4b4b4, Te6edf3sizeTff7b72=Te6edf3instance_managerTff7b72.Td2a8ffsize
Tb4b4b4)
Te6edf3instance_managerTff7b72.Td2a8ffbindTb4b4b4(
Te6edf3posTff7b72=Tff7b72selfTff7b72.Td2a8ffupdate_scrim_rectangleTb4b4b4,
Te6edf3sizeTff7b72=Tff7b72selfTff7b72.Td2a8ffupdate_scrim_rectangleTb4b4b4,
Tb4b4b4)
Tff7b72def Td2a8ffupdate_scrim_rectangleTb4b4b4(
Tff7b72selfTb4b4b4, Te6edf3instance_managerTb4b4b4: Te6edf3ScreenManagerTb4b4b4, Te6edf3sizeTb4b4b4: Tffa657list
Tb4b4b4) Tff7b72-Tff7b72> Tff7b72NoneTb4b4b4:
Tff7b72selfTff7b72.Td2a8ff_scrim_rectangleTff7b72.Td2a8ffpos Tff7b72= Tff7b72selfTff7b72.Td2a8ffpos
Tff7b72selfTff7b72.Td2a8ff_scrim_rectangleTff7b72.Td2a8ffsize Tff7b72= Tff7b72selfTff7b72.Td2a8ffsize
Tff7b72def Td2a8ffadd_widgetTb4b4b4(Tff7b72selfTb4b4b4, Te6edf3widgetTb4b4b4, Te6edf3indexTff7b72=T79c0ff0Tb4b4b4, Te6edf3canvasTff7b72=Tff7b72NoneTb4b4b4)Tb4b4b4:
T8b949e"""
Only two layouts are allowed:
:class:`~kivy.uix.screenmanager.ScreenManager` and
:class:`~MDNavigationDrawer`.
"""
Tff7b72if Tff7b72not Tffa657isinstanceTb4b4b4(
Te6edf3widgetTb4b4b4, Tb4b4b4(Te6edf3MDNavigationDrawerTb4b4b4, Te6edf3ScreenManagerTb4b4b4, Te6edf3MDTopAppBarTb4b4b4)
Tb4b4b4)Tb4b4b4:
Tff7b72raise Te6edf3NavigationDrawerContentErrorTb4b4b4(
Ta5d6ff"Ta5d6ffThe MDNavigationLayout must contain Ta5d6ff"
Ta5d6ff"Ta5d6ffonly `MDNavigationDrawer` and `ScreenManager`Ta5d6ff"
Tb4b4b4)
Tff7b72if Tffa657isinstanceTb4b4b4(Te6edf3widgetTb4b4b4, Te6edf3ScreenManagerTb4b4b4)Tb4b4b4:
Tff7b72selfTff7b72.Td2a8ff_screen_manager Tff7b72= Te6edf3widget
Tff7b72selfTff7b72.Td2a8ffadd_scrimTb4b4b4(Te6edf3widgetTb4b4b4)
Tff7b72if Tffa657isinstanceTb4b4b4(Te6edf3widgetTb4b4b4, Te6edf3MDNavigationDrawerTb4b4b4)Tb4b4b4:
Tff7b72selfTff7b72.Td2a8ff_navigation_drawer Tff7b72= Te6edf3widget
Te6edf3widgetTff7b72.Td2a8ffbindTb4b4b4(
Te6edf3xTff7b72=Tff7b72selfTff7b72.Td2a8ffupdate_posTb4b4b4, Te6edf3widthTff7b72=Tff7b72selfTff7b72.Td2a8ffupdate_posTb4b4b4, Te6edf3anchorTff7b72=Tff7b72selfTff7b72.Td2a8ffupdate_pos
Tb4b4b4)
Tff7b72if Tffa657lenTb4b4b4(Tff7b72selfTff7b72.Td2a8ffchildrenTb4b4b4) Tff7b72> T79c0ff3Tb4b4b4:
Tff7b72raise Te6edf3NavigationDrawerContentErrorTb4b4b4(
Ta5d6ff"Ta5d6ffThe MDNavigationLayout must contain Ta5d6ff"
Ta5d6ff"Ta5d6ffonly `MDNavigationDrawer` and `ScreenManager`Ta5d6ff"
Tb4b4b4)
Tff7b72return Tffa657superTb4b4b4(Tb4b4b4)Tff7b72.Td2a8ffadd_widgetTb4b4b4(Te6edf3widgetTb4b4b4)
Tff7b72class T56d364MDNavigationDrawerLabelTb4b4b4(Te6edf3MDBoxLayoutTb4b4b4)Tb4b4b4:
T8b949e"""
Implements a label for a menu for :class:`~MDNavigationDrawer` class.
For more information, see in the :class:`~kivymd.uix.boxlayout.MDBoxLayout`
class documentation.
.. versionadded:: 1.0.0
.. code-block:: kv
MDNavigationDrawer:
MDNavigationDrawerMenu:
MDNavigationDrawerLabel:
text: "Mail"
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/navigation-drawer-label.png
:align: center
"""
Te6edf3text Tff7b72= Te6edf3StringPropertyTb4b4b4(Tb4b4b4)
T8b949e"""
Text label.
:attr:`text` is a :class:`~kivy.properties.StringProperty`
and defaults to `''`.
"""
Te6edf3padding Tff7b72= Te6edf3VariableListPropertyTb4b4b4(Tb4b4b4[Ta5d6ff"Ta5d6ff20dpTa5d6ff"Tb4b4b4, T79c0ff0Tb4b4b4, T79c0ff0Tb4b4b4, Ta5d6ff"Ta5d6ff8dpTa5d6ff"Tb4b4b4]Tb4b4b4)
T8b949e"""
Padding between layout box and children: [padding_left, padding_top,
padding_right, padding_bottom].
Padding also accepts a two argument form [padding_horizontal,
padding_vertical] and a one argument form [padding].
:attr:`padding` is a :class:`~kivy.properties.VariableListProperty`
and defaults to `['20dp', 0, 0, '8dp']`.
"""
Tff7b72class T56d364MDNavigationDrawerDividerTb4b4b4(Te6edf3MDBoxLayoutTb4b4b4)Tb4b4b4:
T8b949e"""
Implements a divider for a menu for :class:`~MDNavigationDrawer` class.
For more information, see in the :class:`~kivymd.uix.boxlayout.MDBoxLayout`
class documentation.
.. versionadded:: 1.0.0
.. code-block:: kv
MDNavigationDrawer:
MDNavigationDrawerMenu:
MDNavigationDrawerLabel:
text: "Mail"
MDNavigationDrawerDivider:
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/navigation-drawer-divider.png
:align: center
"""
Te6edf3padding Tff7b72= Te6edf3VariableListPropertyTb4b4b4(Tb4b4b4[Ta5d6ff"Ta5d6ff20dpTa5d6ff"Tb4b4b4, Ta5d6ff"Ta5d6ff12dpTa5d6ff"Tb4b4b4, T79c0ff0Tb4b4b4, Ta5d6ff"Ta5d6ff12dpTa5d6ff"Tb4b4b4]Tb4b4b4)
T8b949e"""
Padding between layout box and children: [padding_left, padding_top,
padding_right, padding_bottom].
Padding also accepts a two argument form [padding_horizontal,
padding_vertical] and a one argument form [padding].
:attr:`padding` is a :class:`~kivy.properties.VariableListProperty`
and defaults to `['20dp', '12dp', 0, '12dp']`.
"""
Te6edf3color Tff7b72= Te6edf3ColorPropertyTb4b4b4(Tff7b72NoneTb4b4b4)
T8b949e"""
Divider color in (r, g, b, a) or string format.
:attr:`color` is a :class:`~kivy.properties.ColorProperty`
and defaults to `None`.
"""
Tff7b72class T56d364MDNavigationDrawerHeaderTb4b4b4(Te6edf3MDBoxLayoutTb4b4b4)Tb4b4b4:
T8b949e"""
Implements a header for a menu for :class:`~MDNavigationDrawer` class.
For more information, see in the :class:`~kivymd.uix.boxlayout.MDBoxLayout`
class documentation.
.. versionadded:: 1.0.0
.. code-block:: kv
MDNavigationDrawer:
MDNavigationDrawerMenu:
MDNavigationDrawerHeader:
title: "Header title"
text: "Header text"
spacing: "4dp"
padding: "12dp", 0, 0, "56dp"
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/navigation-drawer-header.png
:align: center
"""
Te6edf3source Tff7b72= Te6edf3StringPropertyTb4b4b4(Tb4b4b4)
T8b949e"""
Image logo path.
.. code-block:: kv
MDNavigationDrawer:
MDNavigationDrawerMenu:
MDNavigationDrawerHeader:
title: "Header title"
text: "Header text"
source: "logo.png"
spacing: "4dp"
padding: "12dp", 0, 0, "56dp"
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/navigation-drawer-header-source.png
:align: center
:attr:`source` is a :class:`~kivy.properties.StringProperty`
and defaults to `''`.
"""
Te6edf3title Tff7b72= Te6edf3StringPropertyTb4b4b4(Tb4b4b4)
T8b949e"""
Title shown in the first line.
:attr:`title` is a :class:`~kivy.properties.StringProperty`
and defaults to `''`.
"""
Te6edf3title_halign Tff7b72= Te6edf3StringPropertyTb4b4b4(Ta5d6ff"Ta5d6ffleftTa5d6ff"Tb4b4b4)
T8b949e"""
Title halign first line.
:attr:`title_halign` is a :class:`~kivy.properties.StringProperty`
and defaults to `'left'`.
"""
Te6edf3title_color Tff7b72= Te6edf3ColorPropertyTb4b4b4(Tff7b72NoneTb4b4b4)
T8b949e"""
Title text color in (r, g, b, a) or string format.
:attr:`title_color` is a :class:`~kivy.properties.ColorProperty`
and defaults to `None`.
"""
Te6edf3title_font_style Tff7b72= Te6edf3StringPropertyTb4b4b4(Ta5d6ff"Ta5d6ffH4Ta5d6ff"Tb4b4b4)
T8b949e"""
Title shown in the first line.
:attr:`title_font_style` is a :class:`~kivy.properties.StringProperty`
and defaults to `'H4'`.
"""
Te6edf3title_font_size Tff7b72= Te6edf3StringPropertyTb4b4b4(Ta5d6ff"Ta5d6ff34spTa5d6ff"Tb4b4b4)
T8b949e"""
Title shown in the first line.
:attr:`title_font_size` is a :class:`~kivy.properties.StringProperty`
and defaults to `'34sp'`.
"""
Te6edf3text Tff7b72= Te6edf3StringPropertyTb4b4b4(Tb4b4b4)
T8b949e"""
Text shown in the second line.
:attr:`text` is a :class:`~kivy.properties.StringProperty`
and defaults to `''`.
"""
Te6edf3text_halign Tff7b72= Te6edf3StringPropertyTb4b4b4(Ta5d6ff"Ta5d6ffleftTa5d6ff"Tb4b4b4)
T8b949e"""
Text halign first line.
:attr:`text_halign` is a :class:`~kivy.properties.StringProperty`
and defaults to `'left'`.
"""
Te6edf3text_color Tff7b72= Te6edf3ColorPropertyTb4b4b4(Tff7b72NoneTb4b4b4)
T8b949e"""
Title text color in (r, g, b, a) or string format.
:attr:`text_color` is a :class:`~kivy.properties.ColorProperty`
and defaults to `None`.
"""
Te6edf3text_font_style Tff7b72= Te6edf3StringPropertyTb4b4b4(Ta5d6ff"Ta5d6ffH6Ta5d6ff"Tb4b4b4)
T8b949e"""
Title shown in the first line.
:attr:`text_font_style` is a :class:`~kivy.properties.StringProperty`
and defaults to `'H6'`.
"""
Te6edf3text_font_size Tff7b72= Te6edf3StringPropertyTb4b4b4(Ta5d6ff"Ta5d6ff20spTa5d6ff"Tb4b4b4)
T8b949e"""
Title shown in the first line.
:attr:`text_font_size` is a :class:`~kivy.properties.StringProperty`
and defaults to `'20sp'`.
"""
Tff7b72def Tff7b72__init__Tb4b4b4(Tff7b72selfTb4b4b4, Tff7b72*Tff7b72*Te6edf3kwargsTb4b4b4)Tb4b4b4:
Tffa657superTb4b4b4(Tb4b4b4)Tff7b72.Td2a8ff__init__Tb4b4b4(Tff7b72*Tff7b72*Te6edf3kwargsTb4b4b4)
Te6edf3ClockTff7b72.Td2a8ffschedule_onceTb4b4b4(Tff7b72selfTff7b72.Td2a8ffcheck_contentTb4b4b4)
Tff7b72def Td2a8ffcheck_contentTb4b4b4(Tff7b72selfTb4b4b4, Te6edf3intervalTb4b4b4: Te6edf3UnionTb4b4b4[Tffa657intTb4b4b4, Tffa657floatTb4b4b4]Tb4b4b4) Tff7b72-Tff7b72> Tff7b72NoneTb4b4b4:
T8b949e"""Removes widgets that the user has not added to the container."""
Tff7b72if Tff7b72not Tff7b72selfTff7b72.Td2a8fftitleTb4b4b4:
Tff7b72selfTff7b72.Td2a8ffidsTff7b72.Td2a8fflabel_boxTff7b72.Td2a8ffremove_widgetTb4b4b4(Tff7b72selfTff7b72.Td2a8ffidsTff7b72.Td2a8fftitleTb4b4b4)
Tff7b72if Tff7b72not Tff7b72selfTff7b72.Td2a8fftextTb4b4b4:
Tff7b72selfTff7b72.Td2a8ffidsTff7b72.Td2a8fflabel_boxTff7b72.Td2a8ffremove_widgetTb4b4b4(Tff7b72selfTff7b72.Td2a8ffidsTff7b72.Td2a8fftextTb4b4b4)
Tff7b72if Tff7b72not Tff7b72selfTff7b72.Td2a8ffsourceTb4b4b4:
Tff7b72selfTff7b72.Td2a8ffremove_widgetTb4b4b4(Tff7b72selfTff7b72.Td2a8ffidsTff7b72.Td2a8fflogoTb4b4b4)
Tff7b72class T56d364MDNavigationDrawerItemTb4b4b4(Te6edf3OneLineAvatarIconListItemTb4b4b4, Te6edf3FocusBehaviorTb4b4b4)Tb4b4b4:
T8b949e"""
Implements an item for the :class:`~MDNavigationDrawer` menu list.
For more information, see in the
:class:`~kivymd.uix.list.OneLineAvatarIconListItem` and
:class:`~kivymd.uix.behaviors.FocusBehavior`
class documentation.
.. versionadded:: 1.0.0
.. code-block:: kv
MDNavigationDrawer:
MDNavigationDrawerMenu:
MDNavigationDrawerHeader:
title: "Header title"
text: "Header text"
spacing: "4dp"
padding: "12dp", 0, 0, "56dp"
MDNavigationDrawerItem
icon: "gmail"
right_text: "+99"
text: "Inbox"
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/navigation-drawer-item.png
:align: center
"""
Te6edf3selected Tff7b72= Te6edf3BooleanPropertyTb4b4b4(Tff7b72FalseTb4b4b4)
T8b949e"""
Is the item selected.
:attr:`selected` is a :class:`~kivy.properties.BooleanProperty`
and defaults to `False`.
"""
Te6edf3icon Tff7b72= Te6edf3StringPropertyTb4b4b4(Tb4b4b4)
T8b949e"""
Icon item.
:attr:`icon` is a :class:`~kivy.properties.StringProperty`
and defaults to `''`.
"""
Te6edf3icon_color Tff7b72= Te6edf3ColorPropertyTb4b4b4(Tff7b72NoneTb4b4b4)
T8b949e"""
Icon color in (r, g, b, a) or string format item.
:attr:`icon_color` is a :class:`~kivy.properties.ColorProperty`
and defaults to `None`.
"""
Te6edf3selected_color Tff7b72= Te6edf3ColorPropertyTb4b4b4(Tb4b4b4[T79c0ff0Tb4b4b4, T79c0ff0Tb4b4b4, T79c0ff0Tb4b4b4, T79c0ff1Tb4b4b4]Tb4b4b4)
T8b949e"""
The color in (r, g, b, a) or string format of the icon and text of the
selected item.
:attr:`selected_color` is a :class:`~kivy.properties.ColorProperty`
and defaults to `[0, 0, 0, 1]`.
"""
Te6edf3right_text Tff7b72= Te6edf3StringPropertyTb4b4b4(Tb4b4b4)
T8b949e"""
Right text item.
:attr:`right_text` is a :class:`~kivy.properties.StringProperty`
and defaults to `''`.
"""
Te6edf3text_right_color Tff7b72= Te6edf3ColorPropertyTb4b4b4(Tff7b72NoneTb4b4b4)
T8b949e"""
Right text color item in (r, g, b, a) or string format.
:attr:`text_right_color` is a :class:`~kivy.properties.ColorProperty`
and defaults to `None`.
"""
Te6edf3_text_color Tff7b72= Tff7b72None
Te6edf3_text_right_color Tff7b72= Tff7b72None
T8b949e# kivymd.uix.navigationdrawer.navigationdrawer.MDNavigationDrawerMenu
Te6edf3_drawer_menu Tff7b72= Te6edf3ObjectPropertyTb4b4b4(Tb4b4b4)
Tff7b72class T56d364MDNavigationDrawerMenuTb4b4b4(Te6edf3MDScrollViewTb4b4b4)Tb4b4b4:
T8b949e"""
Implements a scrollable list for menu items of the
:class:`~MDNavigationDrawer` class.
For more information, see in the
:class:`~kivymd.uix.scrollview.MDScrollView` class documentation.
.. versionadded:: 1.0.0
.. code-block:: kv
MDNavigationDrawer:
MDNavigationDrawerMenu:
# Your menu items.
...
"""
Te6edf3spacing Tff7b72= Te6edf3NumericPropertyTb4b4b4(T79c0ff0Tb4b4b4)
T8b949e"""
Spacing between children, in pixels.
:attr:`spacing` is a :class:`~kivy.properties.NumericProperty`
and defaults to `0`.
"""
Tff7b72def Td2a8ffadd_widgetTb4b4b4(Tff7b72selfTb4b4b4, Te6edf3widgetTb4b4b4, Tff7b72*Te6edf3argsTb4b4b4, Tff7b72*Tff7b72*Te6edf3kwargsTb4b4b4)Tb4b4b4:
Tff7b72if Tffa657isinstanceTb4b4b4(Te6edf3widgetTb4b4b4, Te6edf3MDListTb4b4b4)Tb4b4b4:
Tff7b72return Tffa657superTb4b4b4(Tb4b4b4)Tff7b72.Td2a8ffadd_widgetTb4b4b4(Te6edf3widgetTb4b4b4, Tff7b72*Te6edf3argsTb4b4b4, Tff7b72*Tff7b72*Te6edf3kwargsTb4b4b4)
Tff7b72elseTb4b4b4:
Tff7b72if Tffa657isinstanceTb4b4b4(Te6edf3widgetTb4b4b4, Te6edf3MDNavigationDrawerItemTb4b4b4)Tb4b4b4:
Te6edf3widgetTff7b72.Td2a8ff_drawer_menu Tff7b72= Tff7b72self
Tff7b72selfTff7b72.Td2a8ffidsTff7b72.Td2a8ffmenuTff7b72.Td2a8ffadd_widgetTb4b4b4(Te6edf3widgetTb4b4b4)
Tff7b72def Td2a8ffreset_active_colorTb4b4b4(Tff7b72selfTb4b4b4, Te6edf3itemTb4b4b4: Te6edf3MDNavigationDrawerItemTb4b4b4) Tff7b72-Tff7b72> Tff7b72NoneTb4b4b4:
Tff7b72for Te6edf3widget Tff7b72in Tff7b72selfTff7b72.Td2a8ffidsTff7b72.Td2a8ffmenuTff7b72.Td2a8ffchildrenTb4b4b4:
Tff7b72if Tffa657issubclassTb4b4b4(Te6edf3widgetTff7b72.Td2a8ff__class__Tb4b4b4, Te6edf3MDNavigationDrawerItemTb4b4b4)Tb4b4b4:
Tff7b72if Te6edf3widget Tff7b72!= Te6edf3itemTb4b4b4:
Te6edf3widgetTff7b72.Td2a8ffselected Tff7b72= Tff7b72False
Tff7b72elseTb4b4b4:
Te6edf3widgetTff7b72.Td2a8ffselected Tff7b72= Tff7b72True
Tff7b72if Tb4b4b4(
Tffa657issubclassTb4b4b4(Te6edf3widgetTff7b72.Td2a8ff__class__Tb4b4b4, Te6edf3MDNavigationDrawerItemTb4b4b4)
Tff7b72and Te6edf3widget Tff7b72!= Te6edf3item
Tb4b4b4)Tb4b4b4:
Tff7b72if Te6edf3widgetTff7b72.Td2a8ff_text_colorTb4b4b4:
Te6edf3widgetTff7b72.Td2a8fftext_color Tff7b72= Te6edf3widgetTff7b72.Td2a8ff_text_color
Tff7b72class T56d364MDNavigationDrawerTb4b4b4(Te6edf3MDCardTb4b4b4)Tb4b4b4:
Tffa657type Tff7b72= Te6edf3OptionPropertyTb4b4b4(Ta5d6ff"Ta5d6ffmodalTa5d6ff"Tb4b4b4, Te6edf3optionsTff7b72=Tb4b4b4(Ta5d6ff"Ta5d6ffstandardTa5d6ff"Tb4b4b4, Ta5d6ff"Ta5d6ffmodalTa5d6ff"Tb4b4b4)Tb4b4b4)
T8b949e"""
Type of drawer. Modal type will be on top of screen. Standard type will be
at left or right of screen. Also it automatically disables
:attr:`close_on_click` and :attr:`enable_swiping` to prevent closing
drawer for standard type.
For more information, see in the :class:`~kivymd.uix.card.MDCard`
class documentation.
Standard
--------
.. code-block:: kv
MDNavigationDrawer:
type: "standard"
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/navigation-drawer-standard.gif
:align: center
Modal
-----
.. code-block:: kv
MDNavigationDrawer:
type: "modal"
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/navigation-drawer-modal.gif
:align: center
:attr:`type` is a :class:`~kivy.properties.OptionProperty`
and defaults to `'modal'`.
"""
Te6edf3anchor Tff7b72= Te6edf3OptionPropertyTb4b4b4(Ta5d6ff"Ta5d6ffleftTa5d6ff"Tb4b4b4, Te6edf3optionsTff7b72=Tb4b4b4(Ta5d6ff"Ta5d6ffleftTa5d6ff"Tb4b4b4, Ta5d6ff"Ta5d6ffrightTa5d6ff"Tb4b4b4)Tb4b4b4)
T8b949e"""
Anchoring screen edge for drawer. Set it to `'right'` for right-to-left
languages. Available options are: `'left'`, `'right'`.
Left
----
.. code-block:: kv
MDNavigationDrawer:
anchor: "left"
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/navigation-type-left.png
:align: center
Right
-----
.. code-block:: kv
MDNavigationDrawer:
anchor: "right"
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/navigation-type-right.png
:align: center
:attr:`anchor` is a :class:`~kivy.properties.OptionProperty`
and defaults to `'left'`.
"""
T8b949e# FIXME: Doesn't work in Kivy v2.1.0.
Te6edf3scrim_color Tff7b72= Te6edf3ColorPropertyTb4b4b4(Tb4b4b4[T79c0ff0Tb4b4b4, T79c0ff0Tb4b4b4, T79c0ff0Tb4b4b4, T79c0ff0.5Tb4b4b4]Tb4b4b4)
T8b949e"""
Color for scrim in (r, g, b, a) or string format. Alpha channel will be
multiplied with :attr:`_scrim_alpha`. Set fourth channel to 0 if you want
to disable scrim.
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/navigation-drawer-scrim-color.png
:align: center
.. code-block:: kv
MDNavigationDrawer:
scrim_color: 0, 0, 0, .8
# scrim_color: 0, 0, 0, .2
:attr:`scrim_color` is a :class:`~kivy.properties.ColorProperty`
and defaults to `[0, 0, 0, 0.5]`.
"""
Te6edf3padding Tff7b72= Te6edf3VariableListPropertyTb4b4b4(Tb4b4b4[T79c0ff16Tb4b4b4, T79c0ff16Tb4b4b4, T79c0ff12Tb4b4b4, T79c0ff16Tb4b4b4]Tb4b4b4)
T8b949e"""
Padding between layout box and children: [padding_left, padding_top,
padding_right, padding_bottom].
Padding also accepts a two argument form [padding_horizontal,
padding_vertical] and a one argument form [padding].
.. versionchanged:: 1.0.0
.. code-block:: kv
MDNavigationDrawer:
padding: 56, 56, 12, 16
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/navigation-drawer-padding.png
:align: center
:attr:`padding` is a :class:`~kivy.properties.VariableListProperty` and
defaults to '[16, 16, 12, 16]'.
"""
Te6edf3close_on_click Tff7b72= Te6edf3BooleanPropertyTb4b4b4(Tff7b72TrueTb4b4b4)
T8b949e"""
Close when click on scrim or keyboard escape. It automatically sets to
False for "standard" type.
:attr:`close_on_click` is a :class:`~kivy.properties.BooleanProperty`
and defaults to `True`.
"""
Te6edf3state Tff7b72= Te6edf3OptionPropertyTb4b4b4(Ta5d6ff"Ta5d6ffcloseTa5d6ff"Tb4b4b4, Te6edf3optionsTff7b72=Tb4b4b4(Ta5d6ff"Ta5d6ffcloseTa5d6ff"Tb4b4b4, Ta5d6ff"Ta5d6ffopenTa5d6ff"Tb4b4b4)Tb4b4b4)
T8b949e"""
Indicates if panel closed or opened. Sets after :attr:`status` change.
Available options are: `'close'`, `'open'`.
:attr:`state` is a :class:`~kivy.properties.OptionProperty`
and defaults to `'close'`.
"""
Te6edf3status Tff7b72= Te6edf3OptionPropertyTb4b4b4(
Ta5d6ff"Ta5d6ffclosedTa5d6ff"Tb4b4b4,
Te6edf3optionsTff7b72=Tb4b4b4(
Ta5d6ff"Ta5d6ffclosedTa5d6ff"Tb4b4b4,
Ta5d6ff"Ta5d6ffopening_with_swipeTa5d6ff"Tb4b4b4,
Ta5d6ff"Ta5d6ffopening_with_animationTa5d6ff"Tb4b4b4,
Ta5d6ff"Ta5d6ffopenedTa5d6ff"Tb4b4b4,
Ta5d6ff"Ta5d6ffclosing_with_swipeTa5d6ff"Tb4b4b4,
Ta5d6ff"Ta5d6ffclosing_with_animationTa5d6ff"Tb4b4b4,
Tb4b4b4)Tb4b4b4,
Tb4b4b4)
T8b949e"""
Detailed state. Sets before :attr:`state`. Bind to :attr:`state` instead
of :attr:`status`. Available options are: `'closed'`,
`'opening_with_swipe'`, `'opening_with_animation'`, `'opened'`,
`'closing_with_swipe'`, `'closing_with_animation'`.
:attr:`status` is a :class:`~kivy.properties.OptionProperty`
and defaults to `'closed'`.
"""
Te6edf3open_progress Tff7b72= Te6edf3NumericPropertyTb4b4b4(T79c0ff0.0Tb4b4b4)
T8b949e"""
Percent of visible part of side panel. The percent is specified as a
floating point number in the range 0-1. 0.0 if panel is closed and 1.0 if
panel is opened.
:attr:`open_progress` is a :class:`~kivy.properties.NumericProperty`
and defaults to `0.0`.
"""
Te6edf3enable_swiping Tff7b72= Te6edf3BooleanPropertyTb4b4b4(Tff7b72TrueTb4b4b4)
T8b949e"""
Allow to open or close navigation drawer with swipe. It automatically
sets to False for "standard" type.
:attr:`enable_swiping` is a :class:`~kivy.properties.BooleanProperty`
and defaults to `True`.
"""
Te6edf3swipe_distance Tff7b72= Te6edf3NumericPropertyTb4b4b4(T79c0ff10Tb4b4b4)
T8b949e"""
The distance of the swipe with which the movement of navigation drawer
begins.
:attr:`swipe_distance` is a :class:`~kivy.properties.NumericProperty`
and defaults to `10`.
"""
Te6edf3swipe_edge_width Tff7b72= Te6edf3NumericPropertyTb4b4b4(T79c0ff20Tb4b4b4)
T8b949e"""
The size of the area in px inside which should start swipe to drag
navigation drawer.
:attr:`swipe_edge_width` is a :class:`~kivy.properties.NumericProperty`
and defaults to `20`.
"""
Tff7b72def Td2a8ff_get_scrim_alphaTb4b4b4(Tff7b72selfTb4b4b4)Tb4b4b4:
Te6edf3_scrim_alpha Tff7b72= T79c0ff0
Tff7b72if Tff7b72selfTff7b72.Td2a8fftype Tff7b72== Ta5d6ff"Ta5d6ffmodalTa5d6ff"Tb4b4b4:
Te6edf3_scrim_alpha Tff7b72= Tff7b72selfTff7b72.Td2a8ff_scrim_alpha_transitionTb4b4b4(Tff7b72selfTff7b72.Td2a8ffopen_progressTb4b4b4)
Tff7b72if Tb4b4b4(
Tffa657isinstanceTb4b4b4(Tff7b72selfTff7b72.Td2a8ffparentTb4b4b4, Te6edf3MDNavigationLayoutTb4b4b4)
Tff7b72and Tff7b72selfTff7b72.Td2a8ffparentTff7b72.Td2a8ff_scrim_color
Tb4b4b4)Tb4b4b4:
Tff7b72selfTff7b72.Td2a8ffparentTff7b72.Td2a8ff_scrim_colorTff7b72.Td2a8ffrgba Tff7b72= Tff7b72selfTff7b72.Td2a8ffscrim_colorTb4b4b4[Tb4b4b4:T79c0ff3Tb4b4b4] Tff7b72+ Tb4b4b4[
Tff7b72selfTff7b72.Td2a8ffscrim_colorTb4b4b4[T79c0ff3Tb4b4b4] Tff7b72* Te6edf3_scrim_alpha
Tb4b4b4]
Tff7b72return Te6edf3_scrim_alpha
Te6edf3_scrim_alpha Tff7b72= Te6edf3AliasPropertyTb4b4b4(
Te6edf3_get_scrim_alphaTb4b4b4,
Tff7b72NoneTb4b4b4,
Te6edf3bindTff7b72=Tb4b4b4(Ta5d6ff"Ta5d6ff_scrim_alpha_transitionTa5d6ff"Tb4b4b4, Ta5d6ff"Ta5d6ffopen_progressTa5d6ff"Tb4b4b4, Ta5d6ff"Ta5d6ffscrim_colorTa5d6ff"Tb4b4b4)Tb4b4b4,
Tb4b4b4)
T8b949e"""
Multiplier for alpha channel of :attr:`scrim_color`. For internal
usage only.
"""
Te6edf3scrim_alpha_transition Tff7b72= Te6edf3StringPropertyTb4b4b4(Ta5d6ff"Ta5d6fflinearTa5d6ff"Tb4b4b4)
T8b949e"""
The name of the animation transition type to use for changing
:attr:`scrim_alpha`.
:attr:`scrim_alpha_transition` is a :class:`~kivy.properties.StringProperty`
and defaults to `'linear'`.
"""
Tff7b72def Td2a8ff_get_scrim_alpha_transitionTb4b4b4(Tff7b72selfTb4b4b4)Tb4b4b4:
Tff7b72return Tffa657getattrTb4b4b4(Te6edf3AnimationTransitionTb4b4b4, Tff7b72selfTff7b72.Td2a8ffscrim_alpha_transitionTb4b4b4)
Te6edf3_scrim_alpha_transition Tff7b72= Te6edf3AliasPropertyTb4b4b4(
Te6edf3_get_scrim_alpha_transitionTb4b4b4,
Tff7b72NoneTb4b4b4,
Te6edf3bindTff7b72=Tb4b4b4(Ta5d6ff"Ta5d6ffscrim_alpha_transitionTa5d6ff"Tb4b4b4,Tb4b4b4)Tb4b4b4,
Te6edf3cacheTff7b72=Tff7b72TrueTb4b4b4,
Tb4b4b4)
Te6edf3opening_transition Tff7b72= Te6edf3StringPropertyTb4b4b4(Ta5d6ff"Ta5d6ffout_cubicTa5d6ff"Tb4b4b4)
T8b949e"""
The name of the animation transition type to use when animating to
the :attr:`state` `'open'`.
:attr:`opening_transition` is a :class:`~kivy.properties.StringProperty`
and defaults to `'out_cubic'`.
"""
Te6edf3opening_time Tff7b72= Te6edf3NumericPropertyTb4b4b4(T79c0ff0.2Tb4b4b4)
T8b949e"""
The time taken for the panel to slide to the :attr:`state` `'open'`.
:attr:`opening_time` is a :class:`~kivy.properties.NumericProperty`
and defaults to `0.2`.
"""
Te6edf3closing_transition Tff7b72= Te6edf3StringPropertyTb4b4b4(Ta5d6ff"Ta5d6ffout_sineTa5d6ff"Tb4b4b4)
T8b949e"""The name of the animation transition type to use when animating to
the :attr:`state` 'close'.
:attr:`closing_transition` is a :class:`~kivy.properties.StringProperty`
and defaults to `'out_sine'`.
"""
Te6edf3closing_time Tff7b72= Te6edf3NumericPropertyTb4b4b4(T79c0ff0.2Tb4b4b4)
T8b949e"""
The time taken for the panel to slide to the :attr:`state` `'close'`.
:attr:`closing_time` is a :class:`~kivy.properties.NumericProperty`
and defaults to `0.2`.
"""
Tff7b72def Tff7b72__init__Tb4b4b4(Tff7b72selfTb4b4b4, Tff7b72*Te6edf3argsTb4b4b4, Tff7b72*Tff7b72*Te6edf3kwargsTb4b4b4)Tb4b4b4:
Tffa657superTb4b4b4(Tb4b4b4)Tff7b72.Td2a8ff__init__Tb4b4b4(Tff7b72*Te6edf3argsTb4b4b4, Tff7b72*Tff7b72*Te6edf3kwargsTb4b4b4)
Tff7b72selfTff7b72.Td2a8ffbindTb4b4b4(
Te6edf3open_progressTff7b72=Tff7b72selfTff7b72.Td2a8ffupdate_statusTb4b4b4,
Te6edf3statusTff7b72=Tff7b72selfTff7b72.Td2a8ffupdate_statusTb4b4b4,
Te6edf3stateTff7b72=Tff7b72selfTff7b72.Td2a8ffupdate_statusTb4b4b4,
Tb4b4b4)
Te6edf3WindowTff7b72.Td2a8ffbindTb4b4b4(Te6edf3on_keyboardTff7b72=Tff7b72selfTff7b72.Td2a8ff_handle_keyboardTb4b4b4)
Tff7b72def Td2a8ffset_stateTb4b4b4(Tff7b72selfTb4b4b4, Te6edf3new_stateTff7b72=Ta5d6ff"Ta5d6fftoggleTa5d6ff"Tb4b4b4, Te6edf3animationTff7b72=Tff7b72TrueTb4b4b4) Tff7b72-Tff7b72> Tff7b72NoneTb4b4b4:
T8b949e"""
Change state of the side panel.
New_state can be one of `"toggle"`, `"open"` or `"close"`.
"""
Tff7b72if Te6edf3new_state Tff7b72== Ta5d6ff"Ta5d6fftoggleTa5d6ff"Tb4b4b4:
Te6edf3new_state Tff7b72= Ta5d6ff"Ta5d6ffcloseTa5d6ff" Tff7b72if Tff7b72selfTff7b72.Td2a8ffstate Tff7b72== Ta5d6ff"Ta5d6ffopenTa5d6ff" Tff7b72else Ta5d6ff"Ta5d6ffopenTa5d6ff"
Tff7b72if Te6edf3new_state Tff7b72== Ta5d6ff"Ta5d6ffopenTa5d6ff"Tb4b4b4:
Te6edf3AnimationTff7b72.Td2a8ffcancel_allTb4b4b4(Tff7b72selfTb4b4b4, Ta5d6ff"Ta5d6ffopen_progressTa5d6ff"Tb4b4b4)
Tff7b72selfTff7b72.Td2a8ffstatus Tff7b72= Ta5d6ff"Ta5d6ffopening_with_animationTa5d6ff"
Tff7b72if Te6edf3animationTb4b4b4:
Te6edf3AnimationTb4b4b4(
Te6edf3open_progressTff7b72=T79c0ff1.0Tb4b4b4,
Te6edf3dTff7b72=Tff7b72selfTff7b72.Td2a8ffopening_time Tff7b72* Tb4b4b4(T79c0ff1 Tff7b72- Tff7b72selfTff7b72.Td2a8ffopen_progressTb4b4b4)Tb4b4b4,
Te6edf3tTff7b72=Tff7b72selfTff7b72.Td2a8ffopening_transitionTb4b4b4,
Tb4b4b4)Tff7b72.Td2a8ffstartTb4b4b4(Tff7b72selfTb4b4b4)
Tff7b72elseTb4b4b4:
Tff7b72selfTff7b72.Td2a8ffopen_progress Tff7b72= T79c0ff1
Tff7b72elseTb4b4b4: T8b949e# "close"
Te6edf3AnimationTff7b72.Td2a8ffcancel_allTb4b4b4(Tff7b72selfTb4b4b4, Ta5d6ff"Ta5d6ffopen_progressTa5d6ff"Tb4b4b4)
Tff7b72selfTff7b72.Td2a8ffstatus Tff7b72= Ta5d6ff"Ta5d6ffclosing_with_animationTa5d6ff"
Tff7b72if Te6edf3animationTb4b4b4:
Te6edf3AnimationTb4b4b4(
Te6edf3open_progressTff7b72=T79c0ff0.0Tb4b4b4,
Te6edf3dTff7b72=Tff7b72selfTff7b72.Td2a8ffclosing_time Tff7b72* Tff7b72selfTff7b72.Td2a8ffopen_progressTb4b4b4,
Te6edf3tTff7b72=Tff7b72selfTff7b72.Td2a8ffclosing_transitionTb4b4b4,
Tb4b4b4)Tff7b72.Td2a8ffstartTb4b4b4(Tff7b72selfTb4b4b4)
Tff7b72elseTb4b4b4:
Tff7b72selfTff7b72.Td2a8ffopen_progress Tff7b72= T79c0ff0
Tff7b72def Td2a8ffupdate_statusTb4b4b4(Tff7b72selfTb4b4b4, Tff7b72*Te6edf3_Tb4b4b4) Tff7b72-Tff7b72> Tff7b72NoneTb4b4b4:
Te6edf3status Tff7b72= Tff7b72selfTff7b72.Td2a8ffstatus
Tff7b72if Te6edf3status Tff7b72== Ta5d6ff"Ta5d6ffclosedTa5d6ff"Tb4b4b4:
Tff7b72selfTff7b72.Td2a8ffstate Tff7b72= Ta5d6ff"Ta5d6ffcloseTa5d6ff"
Tff7b72elif Te6edf3status Tff7b72== Ta5d6ff"Ta5d6ffopenedTa5d6ff"Tb4b4b4:
Tff7b72selfTff7b72.Td2a8ffstate Tff7b72= Ta5d6ff"Ta5d6ffopenTa5d6ff"
Tff7b72elif Tff7b72selfTff7b72.Td2a8ffopen_progress Tff7b72== T79c0ff1 Tff7b72and Te6edf3status Tff7b72== Ta5d6ff"Ta5d6ffopening_with_animationTa5d6ff"Tb4b4b4:
Tff7b72selfTff7b72.Td2a8ffstatus Tff7b72= Ta5d6ff"Ta5d6ffopenedTa5d6ff"
Tff7b72selfTff7b72.Td2a8ffstate Tff7b72= Ta5d6ff"Ta5d6ffopenTa5d6ff"
Tff7b72elif Tff7b72selfTff7b72.Td2a8ffopen_progress Tff7b72== T79c0ff0 Tff7b72and Te6edf3status Tff7b72== Ta5d6ff"Ta5d6ffclosing_with_animationTa5d6ff"Tb4b4b4:
Tff7b72selfTff7b72.Td2a8ffstatus Tff7b72= Ta5d6ff"Ta5d6ffclosedTa5d6ff"
Tff7b72selfTff7b72.Td2a8ffstate Tff7b72= Ta5d6ff"Ta5d6ffcloseTa5d6ff"
Tff7b72elif Te6edf3status Tff7b72in Tb4b4b4(
Ta5d6ff"Ta5d6ffopening_with_swipeTa5d6ff"Tb4b4b4,
Ta5d6ff"Ta5d6ffopening_with_animationTa5d6ff"Tb4b4b4,
Ta5d6ff"Ta5d6ffclosing_with_swipeTa5d6ff"Tb4b4b4,
Ta5d6ff"Ta5d6ffclosing_with_animationTa5d6ff"Tb4b4b4,
Tb4b4b4)Tb4b4b4:
Tff7b72pass
Tff7b72if Tff7b72selfTff7b72.Td2a8ffstatus Tff7b72== Ta5d6ff"Ta5d6ffclosedTa5d6ff"Tb4b4b4:
Tff7b72selfTff7b72.Td2a8ffopacity Tff7b72= T79c0ff0
Tff7b72elseTb4b4b4:
Tff7b72selfTff7b72.Td2a8ffopacity Tff7b72= T79c0ff1
Tff7b72def Td2a8ffget_dist_from_sideTb4b4b4(Tff7b72selfTb4b4b4, Te6edf3xTb4b4b4: Tffa657floatTb4b4b4) Tff7b72-Tff7b72> Tffa657floatTb4b4b4:
Tff7b72if Tff7b72selfTff7b72.Td2a8ffanchor Tff7b72== Ta5d6ff"Ta5d6ffleftTa5d6ff"Tb4b4b4:
Tff7b72return T79c0ff0 Tff7b72if Te6edf3x Tff7b72< T79c0ff0 Tff7b72else Te6edf3x
Tff7b72return T79c0ff0 Tff7b72if Te6edf3x Tff7b72> Te6edf3WindowTff7b72.Td2a8ffwidth Tff7b72else Te6edf3WindowTff7b72.Td2a8ffwidth Tff7b72- Te6edf3x
Tff7b72def Td2a8ffon_touch_downTb4b4b4(Tff7b72selfTb4b4b4, Te6edf3touchTb4b4b4)Tb4b4b4:
Tff7b72if Tff7b72selfTff7b72.Td2a8ffstatus Tff7b72== Ta5d6ff"Ta5d6ffclosedTa5d6ff"Tb4b4b4:
Tff7b72return Tff7b72False
Tff7b72elif Tff7b72selfTff7b72.Td2a8ffstatus Tff7b72== Ta5d6ff"Ta5d6ffopenedTa5d6ff"Tb4b4b4:
Tff7b72for Te6edf3child Tff7b72in Tff7b72selfTff7b72.Td2a8ffchildrenTb4b4b4[Tb4b4b4:Tb4b4b4]Tb4b4b4:
Tff7b72if Te6edf3childTff7b72.Td2a8ffdispatchTb4b4b4(Ta5d6ff"Ta5d6ffon_touch_downTa5d6ff"Tb4b4b4, Te6edf3touchTb4b4b4)Tb4b4b4:
Tff7b72return Tff7b72True
Tff7b72if Tff7b72selfTff7b72.Td2a8fftype Tff7b72== Ta5d6ff"Ta5d6ffstandardTa5d6ff" Tff7b72and Tff7b72not Tff7b72selfTff7b72.Td2a8ffcollide_pointTb4b4b4(
Te6edf3touchTff7b72.Td2a8ffoxTb4b4b4, Te6edf3touchTff7b72.Td2a8ffoy
Tb4b4b4)Tb4b4b4:
Tff7b72return Tff7b72False
Tff7b72return Tff7b72True
Tff7b72def Td2a8ffon_touch_moveTb4b4b4(Tff7b72selfTb4b4b4, Te6edf3touchTb4b4b4)Tb4b4b4:
Tff7b72if Tff7b72selfTff7b72.Td2a8ffenable_swipingTb4b4b4:
Tff7b72if Tff7b72selfTff7b72.Td2a8ffstatus Tff7b72== Ta5d6ff"Ta5d6ffclosedTa5d6ff"Tb4b4b4:
Tff7b72if Tb4b4b4(
Tff7b72selfTff7b72.Td2a8ffget_dist_from_sideTb4b4b4(Te6edf3touchTff7b72.Td2a8ffoxTb4b4b4) Tff7b72<Tff7b72= Tff7b72selfTff7b72.Td2a8ffswipe_edge_width
Tff7b72and Tffa657absTb4b4b4(Te6edf3touchTff7b72.Td2a8ffx Tff7b72- Te6edf3touchTff7b72.Td2a8ffoxTb4b4b4) Tff7b72> Tff7b72selfTff7b72.Td2a8ffswipe_distance
Tb4b4b4)Tb4b4b4:
Tff7b72selfTff7b72.Td2a8ffstatus Tff7b72= Ta5d6ff"Ta5d6ffopening_with_swipeTa5d6ff"
Tff7b72elif Tff7b72selfTff7b72.Td2a8ffstatus Tff7b72== Ta5d6ff"Ta5d6ffopenedTa5d6ff"Tb4b4b4:
Tff7b72if Tffa657absTb4b4b4(Te6edf3touchTff7b72.Td2a8ffx Tff7b72- Te6edf3touchTff7b72.Td2a8ffoxTb4b4b4) Tff7b72> Tff7b72selfTff7b72.Td2a8ffswipe_distanceTb4b4b4:
Tff7b72selfTff7b72.Td2a8ffstatus Tff7b72= Ta5d6ff"Ta5d6ffclosing_with_swipeTa5d6ff"
Tff7b72if Tff7b72selfTff7b72.Td2a8ffstatus Tff7b72in Tb4b4b4(Ta5d6ff"Ta5d6ffopening_with_swipeTa5d6ff"Tb4b4b4, Ta5d6ff"Ta5d6ffclosing_with_swipeTa5d6ff"Tb4b4b4)Tb4b4b4:
Tff7b72selfTff7b72.Td2a8ffopen_progress Tff7b72= Tffa657maxTb4b4b4(
Tffa657minTb4b4b4(
Tff7b72selfTff7b72.Td2a8ffopen_progress
Tff7b72+ Tb4b4b4(Te6edf3touchTff7b72.Td2a8ffdx Tff7b72if Tff7b72selfTff7b72.Td2a8ffanchor Tff7b72== Ta5d6ff"Ta5d6ffleftTa5d6ff" Tff7b72else Tff7b72-Te6edf3touchTff7b72.Td2a8ffdxTb4b4b4)
Tff7b72/ Tff7b72selfTff7b72.Td2a8ffwidthTb4b4b4,
T79c0ff1Tb4b4b4,
Tb4b4b4)Tb4b4b4,
T79c0ff0Tb4b4b4,
Tb4b4b4)
Tff7b72return Tff7b72True
Tff7b72return Tffa657superTb4b4b4(Tb4b4b4)Tff7b72.Td2a8ffon_touch_moveTb4b4b4(Te6edf3touchTb4b4b4)
Tff7b72def Td2a8ffon_touch_upTb4b4b4(Tff7b72selfTb4b4b4, Te6edf3touchTb4b4b4)Tb4b4b4:
Tff7b72if Tff7b72selfTff7b72.Td2a8ffstatus Tff7b72== Ta5d6ff"Ta5d6ffopening_with_swipeTa5d6ff"Tb4b4b4:
Tff7b72if Tff7b72selfTff7b72.Td2a8ffopen_progress Tff7b72> T79c0ff0.5Tb4b4b4:
Tff7b72selfTff7b72.Td2a8ffset_stateTb4b4b4(Ta5d6ff"Ta5d6ffopenTa5d6ff"Tb4b4b4, Te6edf3animationTff7b72=Tff7b72TrueTb4b4b4)
Tff7b72elseTb4b4b4:
Tff7b72selfTff7b72.Td2a8ffset_stateTb4b4b4(Ta5d6ff"Ta5d6ffcloseTa5d6ff"Tb4b4b4, Te6edf3animationTff7b72=Tff7b72TrueTb4b4b4)
Tff7b72elif Tff7b72selfTff7b72.Td2a8ffstatus Tff7b72== Ta5d6ff"Ta5d6ffclosing_with_swipeTa5d6ff"Tb4b4b4:
Tff7b72if Tff7b72selfTff7b72.Td2a8ffopen_progress Tff7b72< T79c0ff0.5Tb4b4b4:
Tff7b72selfTff7b72.Td2a8ffset_stateTb4b4b4(Ta5d6ff"Ta5d6ffcloseTa5d6ff"Tb4b4b4, Te6edf3animationTff7b72=Tff7b72TrueTb4b4b4)
Tff7b72elseTb4b4b4:
Tff7b72selfTff7b72.Td2a8ffset_stateTb4b4b4(Ta5d6ff"Ta5d6ffopenTa5d6ff"Tb4b4b4, Te6edf3animationTff7b72=Tff7b72TrueTb4b4b4)
Tff7b72elif Tff7b72selfTff7b72.Td2a8ffstatus Tff7b72== Ta5d6ff"Ta5d6ffopenedTa5d6ff"Tb4b4b4:
Tff7b72if Tff7b72selfTff7b72.Td2a8ffclose_on_click Tff7b72and Tff7b72not Tff7b72selfTff7b72.Td2a8ffcollide_pointTb4b4b4(
Te6edf3touchTff7b72.Td2a8ffoxTb4b4b4, Te6edf3touchTff7b72.Td2a8ffoy
Tb4b4b4)Tb4b4b4:
Tff7b72selfTff7b72.Td2a8ffset_stateTb4b4b4(Ta5d6ff"Ta5d6ffcloseTa5d6ff"Tb4b4b4, Te6edf3animationTff7b72=Tff7b72TrueTb4b4b4)
Tff7b72elif Tff7b72selfTff7b72.Td2a8fftype Tff7b72== Ta5d6ff"Ta5d6ffstandardTa5d6ff" Tff7b72and Tff7b72not Tff7b72selfTff7b72.Td2a8ffcollide_pointTb4b4b4(
Te6edf3touchTff7b72.Td2a8ffoxTb4b4b4, Te6edf3touchTff7b72.Td2a8ffoy
Tb4b4b4)Tb4b4b4:
Tff7b72return Tff7b72False
Tff7b72elif Tff7b72selfTff7b72.Td2a8ffstatus Tff7b72== Ta5d6ff"Ta5d6ffclosedTa5d6ff"Tb4b4b4:
Tff7b72return Tff7b72False
Tff7b72return Tff7b72True
Tff7b72def Td2a8ffon_radiusTb4b4b4(Tff7b72selfTb4b4b4, Te6edf3instance_navigation_drawerTb4b4b4, Te6edf3radius_valueTb4b4b4: Tffa657listTb4b4b4) Tff7b72-Tff7b72> Tff7b72NoneTb4b4b4:
Tff7b72selfTff7b72.Td2a8ff_radius Tff7b72= Te6edf3radius_value
Tff7b72def Td2a8ffon_typeTb4b4b4(Tff7b72selfTb4b4b4, Te6edf3instance_navigation_drawerTb4b4b4, Te6edf3drawer_typeTb4b4b4: Tffa657strTb4b4b4) Tff7b72-Tff7b72> Tff7b72NoneTb4b4b4:
Tff7b72if Tff7b72selfTff7b72.Td2a8fftype Tff7b72== Ta5d6ff"Ta5d6ffstandardTa5d6ff"Tb4b4b4:
Tff7b72selfTff7b72.Td2a8ffenable_swiping Tff7b72= Tff7b72False
Tff7b72selfTff7b72.Td2a8ffclose_on_click Tff7b72= Tff7b72False
Tff7b72elseTb4b4b4:
Tff7b72selfTff7b72.Td2a8ffenable_swiping Tff7b72= Tff7b72True
Tff7b72selfTff7b72.Td2a8ffclose_on_click Tff7b72= Tff7b72True
Tff7b72def Td2a8ff_handle_keyboardTb4b4b4(Tff7b72selfTb4b4b4, Te6edf3windowTb4b4b4, Te6edf3keyTb4b4b4, Tff7b72*Te6edf3largsTb4b4b4)Tb4b4b4:
Tff7b72if Te6edf3key Tff7b72== T79c0ff27 Tff7b72and Tff7b72selfTff7b72.Td2a8ffstatus Tff7b72== Ta5d6ff"Ta5d6ffopenedTa5d6ff" Tff7b72and Tff7b72selfTff7b72.Td2a8ffclose_on_clickTb4b4b4:
Tff7b72selfTff7b72.Td2a8ffset_stateTb4b4b4(Ta5d6ff"Ta5d6ffcloseTa5d6ff"Tb4b4b4)
Tff7b72return Tff7b72True
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────